package jam.network.message;

import jam.network.NetworkController;
import jam.UserInterface.UI.UIController;
import java.util.Scanner;

public class ServerActionInvite extends ServerAction {

	public static void process(String msg) {

		Scanner s = new Scanner(msg);
		s.useDelimiter(":");

		//skip keyword and transID
		s.next();
		int id = s.nextInt();


		String user = s.next();
		String channel = s.next();

		System.out.println(user + " has invited you to  " + channel);
		NetworkController.send( ("SA_INVITE:" + id + ":TRUE") );
		
		ClientActionJoinChannel join = new ClientActionJoinChannel(channel);
		NetworkController.send(join.toString());
	}

}